<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">/*
 * Copyright (c) 2016 JUI All rights reserved.
 */

;(function () {

<span id='JUI-Win'>    /**
</span>     * 窗口&lt;br&gt;
     * &lt;pre&gt;
     win = new JUI.Win({
	contentId:'win'
	,title:'标题(双击最大化)'
	,width:500
	,closable:true
	,onAfterClose:function() {
		alert('关闭后触发')
	}
	,buttons:[
	 	{text:'确定',handler:function(){
	 		alert('OK')
	 	}}
	 	,{text:'取消',handler:function(){
	 		win.hide();
	 	}}
	 ]
});
     * &lt;/pre&gt;
     * @class JUI.Win
     * @extends JUI.Component
     */
    JUI.Class('Win', {
        OPTS: {
<span id='JUI-Win-cfg-contentId'>            /**
</span>             * @cfg {String} contentId 窗口内容的id
             */
            contentId: null
<span id='JUI-Win-cfg-url'>            /**
</span>             * @cfg {String} url 远程请求url,如果和contentId同时存在,则优先使用url
             */
            , url: null
<span id='JUI-Win-cfg-remote'>            /**
</span>             * @cfg {String} remote 是否远程加载页面,默认false,须配合url
             */
            , remote: false
<span id='JUI-Win-cfg-lazyLoad'>            /**
</span>             * @cfg {String} lazyLoad 延迟加载url,如果为true,url在窗口打开的时候加载
             */
            , lazyLoad: true
<span id='JUI-Win-cfg-title'>            /**
</span>             * @cfg {String} title 窗口标题
             */
            , title: ''
<span id='JUI-Win-cfg-closable'>            /**
</span>             * @cfg {Boolean} closable 能否关闭
             */
            , closable: true
<span id='JUI-Win-cfg-draggable'>            /**
</span>             * @cfg {Boolean} draggable 能否拖拽
             */
            , draggable: true
<span id='JUI-Win-cfg-modal'>            /**
</span>             * @cfg {Boolean} modal 是否显示遮罩层
             */
            , modal: true
<span id='JUI-Win-cfg-shadow'>            /**
</span>             * @cfg {Boolean} shadow 是否显示窗体阴影
             */
            , shadow: true
<span id='JUI-Win-cfg-autoHide'>            /**
</span>             * @cfg {Boolean} autoHide 一开始隐藏
             */
            , autoHide: true
<span id='JUI-Win-cfg-maximizable'>            /**
</span>             * @cfg {Boolean} maximizable 能否最大化
             */
            , maximizable: true
            , position: 'fixed'
<span id='JUI-Win-cfg-buttons'>            /**
</span>             * @cfg {Array} buttons 底部按钮
             */
            , buttons: []
        }
        // ----- 事件注释 -----

<span id='JUI-Win-event-onClose'>        /**
</span>         * @event onClose 在用户关闭窗口时触发,返回false终止当前操作。
         */

<span id='JUI-Win-event-AfterClose'>        /**
</span>         * @event AfterClose 在用户关闭窗口后触发。
         */


<span id='global-method-constructor'>        /**
</span>         * 构造函数
         * @constructor
         * @ignore
         */
        , init: function (opts) {
            this._super(opts);
        }
<span id='JUI-Win-method-setTitle'>        /**
</span>         * 设置标题
         * @param {String} title
         */
        , setTitle: function (title) {
            this.view.setTitle(title);
        }
<span id='JUI-Win-method-setUrl'>        /**
</span>         * 设置远程加载页面
         * @param {String} title
         */
        , setUrl: function (url) {
            this.view.setUrl(url);
        }
<span id='global-method-getViewClass'>        /**
</span>         * @private
         * @ignore
         */
        , getViewClass: function () {
            return JUI.WinView;
        }
<span id='global-method-hasBtns'>        /**
</span>         * @ignore
         */
        , hasBtns: function () {
            return this.opts.buttons &amp;&amp; this.opts.buttons.length &gt; 0;
        }
<span id='JUI-Win-method-move'>        /**
</span>         * 移动
         * @param {Number} left
         * @param {Number} top
         */
        , move: function (left, top) {
            this.view.move(left, top);
        }
<span id='JUI-Win-method-hide'>        /**
</span>         * 隐藏
         */
        , hide: function () {
            var ret = this.fire('Close');
            if (ret === false) {
                return;
            }

            this.view.hide();

            this.fire('AfterClose');
        }
<span id='JUI-Win-method-close'>        /**
</span>         * 隐藏,同hide()
         */
        , close: function () {
            this.hide();
        }
<span id='JUI-Win-method-max'>        /**
</span>         * 最大化
         */
        , max: function () {
            this.view.max();
        }
//        /**
//         * 最小化
//         */
//        , min: function () {
//            this.view.min();
//        }
<span id='JUI-Win-method-normal'>        /**
</span>         * 正常
         */
        , normal: function () {
            this.view.normal();
        }
<span id='JUI-Win-method-hideBtn'>        /**
</span>         * 隐藏按钮
         * @param {Number} index 按钮索引
         */
        , hideBtn: function (index) {
            this.view.hideBtn(index);
        }
<span id='JUI-Win-method-showBtn'>        /**
</span>         * 显示按钮
         * @param {Number} index 按钮索引
         */
        , showBtn: function (index) {
            this.view.showBtn(index);
        }
    }, JUI.Component);

})();</pre>
</body>
</html>
